-----------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/hy21/Dropbox/Lobbyists as Gatekeeper_Combined/Data Files and Code/JOP replication/replication
> .log
  log type:  text
 opened on:   8 Aug 2022, 18:27:12

. *******************************************************************************
. * TABLE 1: Lobbyists and Lobbying Fee: Summary Statistics                               
. *******************************************************************************
. clear

. use contacts.dta

. keep if lob_lastname != ""
(6,586 observations deleted)

. keep if congress>=110 & congress<=111
(696 observations deleted)

. drop lob_lastname1-lob_firstname4

. merge n:1 registrantid fyear fmonth using registrant_info.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           233
        from master                         0  (_merge==1)
        from using                        233  (_merge==2)

    matched                             7,046  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(233 observations deleted)

. drop _merge

. gen year = year(contactdate)
(782 missing values generated)

. replace year = fyear if year == . & fmonth>3
(459 real changes made)

. replace year = fyear-1 if year == . & fmonth<=3
(323 real changes made)

. bys lob_lastname lob_firstname registrantid icpsr: gen mm = _n == 1

. bys lob_lastname lob_firstname registrantid: egen nummem = sum(mm)

. bys lob_lastname lob_firstname registrantid icpsr contactlevel: gen mc = _n == 1

. replace mc = 0 if contactlevel == "Staff"
(2,311 real changes made)

. bys lob_lastname lob_firstname registrantid: egen numdmem = sum(mc)

. gen a = 0

. replace a = 1 if contactlevel == "Member"
(2,098 real changes made)

. bys lob_lastname lob_firstname registrantid: egen numcont = count(a)

. bys lob_lastname lob_firstname registrantid: egen numdcont = sum(a)

. bys lob_lastname lob_firstname registrantid: egen mfara = mean(startyear)

. bys lob_lastname lob_firstname registrantid: egen mnumlob = mean(numlob)
(177 missing values generated)

. bys lob_lastname lob_firstname registrantid clientcountry year: gen aa = _n == 1

. bys lob_lastname lob_firstname registrantid year: egen numclient = sum(aa)

. bys lob_lastname lob_firstname registrantid clientcountry year contactlevel: gen am = _n == 1

. replace am = 0 if contactlevel == "Staff"
(396 real changes made)

. bys lob_lastname lob_firstname registrantid year: egen numdclient = sum(am)

. keep lob_lastname lob_firstname registrantid numcont numdcont nummem numdmem mfara mnumlob numclient numdclient
>  year

. order lob_lastname lob_firstname registrantid numcont numdcont nummem numdmem mfara mnumlob numclient numdclien
> t year

. duplicates drop

Duplicates in terms of all variables

(6,697 observations deleted)

. collapse (mean) numcont numdcont nummem numdmem mfara mnumlob numclient numdclient, by(lob_lastname lob_firstna
> me registrantid)

. merge 1:1 registrantid lob_lastname lob_firstname using lobbyist_attributes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            20
        from master                         0  (_merge==1)
        from using                         20  (_merge==2)

    matched                               223  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(20 observations deleted)

. drop _merge

. replace expol = 1 if expol == 2
(5 real changes made)

. replace expol = 0 if expol == .
(6 real changes made)

. gen lob_dwmean = .
(223 missing values generated)

. replace lob_dwmean = expol_dw if expol_dw != .
(21 real changes made)

. replace lob_dwmean = mem1_dw if mem1_dw! = . & mem2_dw == .
(85 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw)/2 if mem1_dw! = . & mem2_dw != . & mem3_dw == . 
(7 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw+mem3_dw)/3 if mem1_dw! = . & mem2_dw != . & mem3_dw != . 
(5 real changes made)

. gen govexp = 0

. replace govexp = 1 if expol == 1
(25 real changes made)

. replace govexp = 1 if staffer == 1
(96 real changes made)

. replace govexp = 1 if govexp == 0 & whitehouse == 1
(32 real changes made)

. 
. * TABLE 1 Panels on ideology and career history 
. tabstat lob_democrat cfscore lob_dwmean expol staffer whitehouse, stat(N mean sd min max) col(stat)

    variable |         N      mean        sd       min       max
-------------+--------------------------------------------------
lob_democrat |       180  .5055556  .5013638         0         1
     cfscore |       148 -.0569338  .7545338 -1.079385   1.10648
  lob_dwmean |       117   .025886  .4069625     -.594      .842
       expol |       223  .1121076  .3162086         0         1
     staffer |       223  .4349776  .4968694         0         1
  whitehouse |       223  .2376682  .4266124         0         1
----------------------------------------------------------------

. * TABLE 1 Panels on lobbying contacts to Members of Congress
. tabstat numcont numdcont nummem numdmem numclient numdclient, stat(N mean sd min max) col(stat)

    variable |         N      mean        sd       min       max
-------------+--------------------------------------------------
     numcont |       223  31.59641  93.23466         1       899
    numdcont |       223  9.408072  35.32831         0       328
      nummem |       223  12.98655  25.06648         1       202
     numdmem |       223  5.811659  19.45821         0       167
   numclient |       223  1.178999  .4463915         1         4
  numdclient |       223  .5302691  .5401074         0         2
----------------------------------------------------------------

. 
. 
. clear

. use contacts_110th.dta

. append using contacts_111th.dta
(note: variable registrantname was str80, now str111 to accommodate using data's values)
(note: variable contactagency was str82, now str112 to accommodate using data's values)

. duplicates drop

Duplicates in terms of all variables

(1,065 observations deleted)

. gen a = 0

. replace a = 1 if conagency == "Media" | conagency == "Other"
(2,296 real changes made)

. bys registrantid clientcountry fyear fmonth: egen media = sum(a)

. replace a = 0
(2,296 real changes made)

. replace a = 1 if conagency == "Executive"
(4,036 real changes made)

. bys registrantid clientcountry fyear fmonth: egen exec = sum(a)

. replace a = 0
(4,036 real changes made)

. replace a = 1 if conagency == "Congress" & memberid == ""
(2,421 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_comm = sum(a)

. keep registrantid clientcountry fyear fmonth media exec cong_comm 

. duplicates drop

Duplicates in terms of all variables

(21,060 observations deleted)

. label var media "number of media/academia/other contacts"

. label var exec "number of executive contacts"

. label var cong_comm "number of congressional contacts: committee"

. save temp.dta, replace
(note: file temp.dta not found)
file temp.dta saved

. clear

. use contacts.dta

. merge n:1 registrantid lob_lastname lob_firstname using lobbyist_attributes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         6,603
        from master                     6,586  (_merge==1)
        from using                         17  (_merge==2)

    matched                             7,742  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(17 observations deleted)

. drop _merge

. merge n:n icpsr congress using masterdata_congress.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,347
        from master                         0  (_merge==1)
        from using                      1,347  (_merge==2)

    matched                            14,329  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(1,347 observations deleted)

. drop _merge

. duplicates drop

Duplicates in terms of all variables

(18 observations deleted)

. replace primary_committee = upper(primary_committee)
(14,311 real changes made)

. gen leader = 0

. replace leader = 1 if maj_leader == 1
(1,079 real changes made)

. replace leader = 1 if min_leader == 1
(700 real changes made)

. replace leader = 1 if primary_committee == "SPEAKER"
(106 real changes made)

. replace leader = 1 if primary_committee == "MAJORITY LEADER"
(3 real changes made)

. replace leader = 1 if primary_committee == "MAJORITY WHIP"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY LEADER"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY WHIP"
(0 real changes made)

. replace leader = 1 if chair == 1
(2,103 real changes made)

. label var leader "party leaders"

. gen foreign = 0

. replace foreign = 1 if primary_committee == "FOREIGN AFFAIRS"
(1,080 real changes made)

. replace foreign = 1 if primary_committee == "FOREIGN RELATIONS"
(478 real changes made)

. label var foreign "foreign relations/affairs committee"

. gen a = 1

. bys registrantid clientcountry fyear fmonth: egen cong = sum(a)

. label var cong "number of congressional contacts"

. bys registrantid clientcountry fyear fmonth: egen cong_leader = sum(leader)

. label var cong_leader "number of contacts to congressional leaders"

. bys registrantid clientcountry fyear fmonth: egen cong_foreign = sum(foreign)

. label var cong_foreign "number of contacts to foreign affairs/relations"

. gen cfdiff = abs(cfscore-polcfscore)
(8,395 missing values generated)

. sum cfdiff, detail

                           cfdiff
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0053233       .0001485
 5%     .0367549       .0001485
10%     .0611865         .00123       Obs               5,916
25%     .1411609       .0017982       Sum of Wgt.       5,916

50%     .3728391                      Mean           .5062634
                        Largest       Std. Dev.        .44356
75%     .7661609       2.141722
90%     1.214839       2.143948       Variance       .1967455
95%     1.340901       2.218841       Skewness       1.033155
99%     1.752833       2.335709       Kurtosis       3.324131

. replace a = 0
(14,311 real changes made)

. replace a = 1 if cfdiff<r(p50)
(2,952 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close = sum(a)

. label var cong_close "number of contacts by a close lobbyist"

. gen lob_dwmean = .
(14,311 missing values generated)

. replace lob_dwmean = expol_dw if expol_dw != .
(972 real changes made)

. replace lob_dwmean = mem1_dw if mem1_dw! = . & mem2_dw == .
(1,235 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw)/2 if mem1_dw! = . & mem2_dw != . & mem3_dw == . 
(208 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw+mem3_dw)/3 if mem1_dw! = . & mem2_dw != . & mem3_dw != . 
(139 real changes made)

. gen dwdiff = abs(dwnom1-lob_dwmean)
(11,776 missing values generated)

. sum dwdiff, detail

                           dwdiff
-------------------------------------------------------------
      Percentiles      Smallest
 1%         .002              0
 5%        .0135              0
10%         .027              0       Obs               2,535
25%     .0666667              0       Sum of Wgt.       2,535

50%         .152                      Mean           .2578412
                        Largest       Std. Dev.      .2753223
75%         .328       1.235333
90%        .7315          1.252       Variance       .0758024
95%          .87          1.307       Skewness       1.548115
99%     1.114333          1.319       Kurtosis       4.557162

. replace a = 0
(2,952 real changes made)

. replace a = 1 if dwdiff<r(p50)
(1,267 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close_dw = sum(a)

. label var cong_close_dw "number of contacts by a close lobbyist (DW)"

. gen partydiff = .
(14,311 missing values generated)

. replace partydiff = 1 if democrat == 1 & lob_rep == 1
(944 real changes made)

. replace partydiff = 1 if democrat == 0 & lob_rep == 0
(166 real changes made)

. replace partydiff = 0 if democrat == 0 & lob_rep == 1
(2,340 real changes made)

. replace partydiff = 0 if democrat == 1 & lob_rep == 0
(1,596 real changes made)

. replace a = 0
(1,267 real changes made)

. replace a = 1 if partydiff == 0
(3,936 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close_py = sum(a)

. label var cong_close_dw "number of contacts by a same-party lobbyist"

. gen ck = 0

. replace ck = 1 if cfdiff ==.
(8,395 real changes made)

. bys registrantid clientcountry fyear fmonth: egen nocfinfo = min(ck)

. keep registrantid clientcountry fyear fmonth cong cong_leader cong_foreign cong_close* nocfinfo

. duplicates drop

Duplicates in terms of all variables

(13,644 observations deleted)

. merge 1:1 registrantid clientcountry fyear fmonth using temp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           172
        from master                        27  (_merge==1)
        from using                        145  (_merge==2)

    matched                               640  (_merge==3)
    -----------------------------------------

. replace cong = 0 if _merge == 2
(145 real changes made)

. replace cong_leader = 0 if _merge == 2
(145 real changes made)

. replace cong_foreign = 0 if _merge == 2
(145 real changes made)

. replace cong_close = 0 if _merge == 2
(145 real changes made)

. replace nocfinfo = 0 if _merge == 2
(145 real changes made)

. replace media = 0 if _merge == 1
(27 real changes made)

. replace exec = 0 if _merge == 1
(27 real changes made)

. replace cong_comm = 0 if _merge == 1
(27 real changes made)

. drop _merge

. save temp.dta, replace
file temp.dta saved

. clear

. use clientcountry_yearly.dta

. bys clientcountry: egen UNagree = mean(pctagreeus)
(88 missing values generated)

. keep clientcountry UNagree polity

. duplicates drop

Duplicates in terms of all variables

(627 observations deleted)

. sum UNagree, detail

                           UNagree
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0519484       .0510393
 5%     .0728319       .0519484
10%      .078001       .0550153       Obs                 187
25%     .0902993       .0609871       Sum of Wgt.         187

50%     .1097886                      Mean           .1795149
                        Largest       Std. Dev.      .1364751
75%     .3144231       .6169736
90%     .3473414       .6850649       Variance       .0186255
95%     .3658378        .710223       Skewness       1.720873
99%      .710223       .7737534       Kurtosis       6.151824

. sum polity,detail

                   polity IV score in 2005
-------------------------------------------------------------
      Percentiles      Smallest
 1%          -10            -10
 5%           -8            -10
10%           -7            -10       Obs                 162
25%           -3             -9       Sum of Wgt.         162

50%            6                      Mean           3.512346
                        Largest       Std. Dev.      6.540118
75%            9             10
90%           10             10       Variance       42.77314
95%           10             10       Skewness      -.6902038
99%           10             10       Kurtosis       1.951237

. save clienttemp.dta, replace
(note: file clienttemp.dta not found)
file clienttemp.dta saved

. clear

. use contracts_list.dta

. merge 1:1 registrantid clientcountry fyear fmonth using temp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           164
        from master                         0  (_merge==1)
        from using                        164  (_merge==2)

    matched                               648  (_merge==3)
    -----------------------------------------

. drop if _merge == 2     
(164 observations deleted)

. drop _merge

. erase temp.dta

. merge n:1 registrantid fyear fmonth using registrant_info.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            19
        from master                         0  (_merge==1)
        from using                         19  (_merge==2)

    matched                               648  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(19 observations deleted)

. drop _merge

. merge n:1 clientcountry using clienttemp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           124
        from master                         2  (_merge==1)
        from using                        122  (_merge==2)

    matched                               646  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(122 observations deleted)

. drop _merge

. erase clienttemp.dta

. gen lfee = log(fee)
(24 missing values generated)

. gen numlob2 = numlob*numlob
(24 missing values generated)

. gen nhclients2 = nhclients*nhclients

. replace cong = cong + cong_comm
(386 real changes made)

. gen insample = 1

. replace insample = 0 if nocfinfo == 1
(424 real changes made)

. gen autocracy = 0

. replace autocracy = 1 if polity<=0
(187 real changes made)

. gen close_auto = cong_close*autocracy

. gen close_auto_dw = cong_close_dw*autocracy

. gen close_auto_py = cong_close_py*autocracy

. gen cong_auto = cong*autocracy

. replace fee = fee/1000
(624 real changes made)

. 
. * TABLE 1 panel on semi-annual activities per client
. sum fee cong media exec startyear domestic numlob if fee>0 & insample == 1

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         fee |        214    217.5594    255.1178    5.64054       1965
        cong |        214    33.01402    53.79796          1        361
       media |        214    1.602804    4.968085          0         45
        exec |        214    5.294393    11.44787          0         99
   startyear |        214    2002.472    7.356557       1979       2010
-------------+---------------------------------------------------------
    domestic |        214     .864486    .3430743          0          1
      numlob |        203      11.133    10.18235          1         35

.            
. 
. *******************************************************************************
. * FIGURE 4 (a): Lobbying Contacts and Ideological Differences                                    
. *******************************************************************************
. clear 

. use main_panel_summary.dta

. xtile group = cfdiff, nq(10)

. bys group: egen groupx = mean(cfdiff)
(41720 missing values generated)

. bys group dem_max: egen dsmean = mean(any)

. bys group dem_max: egen dsn = count(any)

. bys group dem_max: egen dsse = sd(any)

. replace dsse = 0 if dsse == .
(0 real changes made)

. replace dsse = dsse/sqrt(dsn)
(124,274 real changes made)

. replace dsmean = dsmean*100
(124,274 real changes made)

. replace dsse = dsse*100
(124,274 real changes made)

. gen upper = dsmean + 1.96*dsse

. gen lower = dsmean - 1.96*dsse

. twoway (rcap upper lower groupx if dem_max == 1, lcolor(black) yscale(range(0 6) ) ///
>        graphregion(color(white))) (rcap upper lower groupx if dem_max ==0, lcolor(gs7)) ///
>            (scatter dsmean groupx if dem_max == 1, connect(l) msymbol(circle) mcolor(black) lcolor(black)) ///
>            (scatter dsmean groupx if dem_max ==0, connect(l) msymbol(diamond_hollow) mcolor(gs7) lcolor(gs5)) /
> //
>            , xtitle("Absolute Difference in the CF Scores") ytitle("Probability of Having Any Contact (%)") ///
>            legend(order(3 "Democrat" 4 "Republican") cols(2) pos(2) ring(0)) 

. 
.            
. *******************************************************************************
. * FIGURE 4 (b): Lobbying Contacts and Ideological Differences                                    
. *******************************************************************************
. clear

. use main_panel_summary.dta

. keep if any > 0
(121,378 observations deleted)

. xtile group = cfdiff, nq(10)

. gen outcome = ncclients

. bys group: egen groupx = mean(cfdiff)
(790 missing values generated)

. bys group: egen dsmean = mean(outcome)

. bys group: egen dsn = count(outcome)

. bys group: egen dsse = sd(outcome)

. replace dsse = 0 if dsse == .
(0 real changes made)

. replace dsse = dsse/sqrt(dsn)
(2,896 real changes made)

. gen upper = dsmean + 1.96*dsse

. gen lower = dsmean - 1.96*dsse

. bys group: egen fracdiff = mean(partydiff)

. gen gov = max(expol, staffer, whitehouse)

. replace gov = 1 if gov>1
(40 real changes made)

. bys group: egen fracgov = mean(gov)

. 
. twoway (rcap upper lower groupx, lcolor(black) graphregion(color(white))) ///
>            (scatter dsmean groupx, connect(l) msymbol(circle) mcolor(black) lcolor(black)) ///
>            , xtitle("Absolute Difference in CF Scores") ytitle("Number of Clients with Contacts") legend(off)  
>        

.            
.            
. *******************************************************************************
. * TABLE 2: To Which Lobbyists Do Politicians Give Access? (Extensive Margin)                                   
>   
. *******************************************************************************
. clear

. use main_panel_summary.dta

. egen polid = group(icpsr)

. egen lobid = group(lob_firstname lob_lastname registrantid)

. macro define lob_char "numlob numlob2 startyear expol staffer whitehouse"

. 
. * regression results
. eststo clear

. eststo: quietly reg any cfdiff $lob_char, a(polid) cluster(polid)
(est1 stored)

. eststo: quietly reg dany cfdiff $lob_char, a(polid) cluster(polid)
(est2 stored)

. eststo: quietly reg any partydiff $lob_char, a(polid) cluster(polid)
(est3 stored)

. eststo: quietly reg dany partydiff $lob_char, a(polid) cluster(polid)
(est4 stored)

. eststo: quietly reg any dwdiff $lob_char, a(polid) cluster(polid)
(est5 stored)

. eststo: quietly reg dany dwdiff $lob_char, a(polid) cluster(polid)
(est6 stored)

. esttab, star(* 0.10 ** 0.05 *** 0.01) se ar2 keep(cfdiff partydiff dwdiff) b(%5.4f)

------------------------------------------------------------------------------------------------------------
                      (1)             (2)             (3)             (4)             (5)             (6)   
                      any            dany             any            dany             any            dany   
------------------------------------------------------------------------------------------------------------
cfdiff            -0.0218***      -0.0102***                                                                
                 (0.0010)        (0.0006)                                                                   

partydiff                                         -0.0229***      -0.0098***                                
                                                 (0.0012)        (0.0007)                                   

dwdiff                                                                            -0.0336***      -0.0157***
                                                                                 (0.0020)        (0.0011)   
------------------------------------------------------------------------------------------------------------
N                   78762           78762           96020           96020           63508           63508   
adj. R-sq           0.031           0.022           0.023           0.016           0.029           0.024   
------------------------------------------------------------------------------------------------------------
Standard errors in parentheses
* p<0.10, ** p<0.05, *** p<0.01

. 
. * mean dependent variables
. tabstat any dany if cfdiff!=.           // columns (1) and (2)

   stats |       any      dany
---------+--------------------
    mean |  .0255106  .0123434
------------------------------

. tabstat any dany if partydiff!=.        // columns (3) and (4)

   stats |       any      dany
---------+--------------------
    mean |  .0217287  .0086254
------------------------------

. tabstat any dany if dwdiff!=.           // columsn (5) and (6)

   stats |       any      dany
---------+--------------------
    mean |  .0199411   .008919
------------------------------

.                    
.                 
. **********************************************************************************
. * TABLE 3: Which Lobbyists Do Politicians Meet More Frequently? (Intensive Margin)                             
>           
. **********************************************************************************
. clear

. use main_panel_summary.dta

. egen polid = group(icpsr)

. egen lobid = group(lob_firstname lob_lastname registrantid)

. macro define firm_char "numlob numlob2 startyear"

. macro define lob_char "expol staffer whitehouse"

. keep if any>0   // focus on pairs with contacts
(121,378 observations deleted)

. keep if expol!=. & staffer !=. & whitehouse !=. // focus on those with career information
(0 observations deleted)

. gen lnumconts = log(numconts+1)

. gen lncclients = log(ncclients+1)

. gen lcfdiff = log(cfdiff) 
(790 missing values generated)

. 
. * regression results
. eststo clear

. eststo: quietly areg lncclients  lcfdiff $firm_char, a(polid) cluster(polid)
(est1 stored)

. eststo: quietly areg lncclients  lcfdiff $firm_char $lob_char, a(polid) cluster(polid)
(est2 stored)

. eststo: quietly areg select_cur  lcfdiff $firm_char, a(polid) cluster(polid)
(est3 stored)

. eststo: quietly areg select_cur lcfdiff $firm_char $lob_char, a(polid) cluster(polid)
(est4 stored)

. eststo: quietly areg lnumconts   lcfdiff $firm_char, a(polid) cluster(polid)
(est5 stored)

. eststo: quietly areg lnumconts  lcfdiff $firm_char $lob_char, a(polid) cluster(polid)
(est6 stored)

. esttab, star(* 0.10 ** 0.05 *** 0.01) se ar2 keep(lcfdiff expol staffer whitehouse) b(%5.3f)

------------------------------------------------------------------------------------------------------------
                      (1)             (2)             (3)             (4)             (5)             (6)   
               lncclients      lncclients      select_cur      select_cur       lnumconts       lnumconts   
------------------------------------------------------------------------------------------------------------
lcfdiff             0.017***        0.009**         0.022***        0.014**         0.031***        0.017   
                  (0.004)         (0.004)         (0.006)         (0.006)         (0.011)         (0.011)   

expol                              -0.105***                       -0.082***                       -0.165***
                                  (0.011)                         (0.016)                         (0.025)   

staffer                            -0.042***                       -0.053***                       -0.155***
                                  (0.013)                         (0.018)                         (0.028)   

whitehouse                         -0.136***                       -0.157***                       -0.249***
                                  (0.012)                         (0.018)                         (0.030)   
------------------------------------------------------------------------------------------------------------
N                    2032            2032            2032            2032            2032            2032   
adj. R-sq           0.110           0.253           0.222           0.286           0.143           0.215   
------------------------------------------------------------------------------------------------------------
Standard errors in parentheses
* p<0.10, ** p<0.05, *** p<0.01

. 
. * mean dependent variables 
. tabstat lncclients select_cur lnumconts if any > 0 & lcfdiff!=., col(stat)

    variable |      mean
-------------+----------
  lncclients |  .5068222
  select_cur |  .3643393
   lnumconts |  .7465214
------------------------

. 
. 
. *******************************************************************************
. * TABLE 4: What Determines Lobbying Fee?                                            
. *******************************************************************************
. clear

. use contacts_110th.dta

. append using contacts_111th.dta
(note: variable registrantname was str80, now str111 to accommodate using data's values)
(note: variable contactagency was str82, now str112 to accommodate using data's values)

. duplicates drop

Duplicates in terms of all variables

(1,065 observations deleted)

. gen a = 0

. replace a = 1 if conagency == "Media" | conagency == "Other"
(2,296 real changes made)

. bys registrantid clientcountry fyear fmonth: egen media = sum(a)

. replace a = 0
(2,296 real changes made)

. replace a = 1 if conagency == "Executive"
(4,036 real changes made)

. bys registrantid clientcountry fyear fmonth: egen exec = sum(a)

. replace a = 0
(4,036 real changes made)

. replace a = 1 if conagency == "Congress" & memberid == ""
(2,421 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_comm = sum(a)

. replace a = 0
(2,421 real changes made)

. replace a = 1 if issue == "BUD"
(2,365 real changes made)

. bys registrantid clientcountry fyear fmonth: egen iss_bud = max(a)

. replace a = 0
(2,365 real changes made)

. replace a = 1 if issue == "SEC"
(4,665 real changes made)

. bys registrantid clientcountry fyear fmonth: egen iss_sec = max(a)

. replace a = 0
(4,665 real changes made)

. replace a = 1 if issue == "TRD"
(4,297 real changes made)

. bys registrantid clientcountry fyear fmonth: egen iss_trd = max(a)

. keep registrantid clientcountry fyear fmonth media exec cong_comm iss_bud iss_sec iss_trd

. duplicates drop

Duplicates in terms of all variables

(21,060 observations deleted)

. label var media "number of media/academia/other contacts"

. label var exec "number of executive contacts"

. label var cong_comm "number of congressional contacts: committee"

. label var iss_bud "any contracts on budget issue"

. label var iss_sec "any contracts on security issue"

. label var iss_trd "any contracts on trade issue"

. save temp.dta, replace
(note: file temp.dta not found)
file temp.dta saved

. clear

. use contacts.dta

. merge n:1 registrantid lob_lastname lob_firstname using lobbyist_attributes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         6,603
        from master                     6,586  (_merge==1)
        from using                         17  (_merge==2)

    matched                             7,742  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(17 observations deleted)

. drop _merge

. merge n:n icpsr congress using masterdata_congress.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,347
        from master                         0  (_merge==1)
        from using                      1,347  (_merge==2)

    matched                            14,329  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(1,347 observations deleted)

. drop _merge

. duplicates drop

Duplicates in terms of all variables

(18 observations deleted)

. replace primary_committee = upper(primary_committee)
(14,311 real changes made)

. gen leader = 0

. replace leader = 1 if maj_leader == 1
(1,079 real changes made)

. replace leader = 1 if min_leader == 1
(700 real changes made)

. replace leader = 1 if primary_committee == "SPEAKER"
(106 real changes made)

. replace leader = 1 if primary_committee == "MAJORITY LEADER"
(3 real changes made)

. replace leader = 1 if primary_committee == "MAJORITY WHIP"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY LEADER"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY WHIP"
(0 real changes made)

. replace leader = 1 if chair == 1
(2,103 real changes made)

. label var leader "party leaders"

. gen foreign = 0

. replace foreign = 1 if primary_committee == "FOREIGN AFFAIRS"
(1,080 real changes made)

. replace foreign = 1 if primary_committee == "FOREIGN RELATIONS"
(478 real changes made)

. label var foreign "foreign relations/affairs committee"

. gen a = 1

. bys registrantid clientcountry fyear fmonth: egen cong = sum(a)

. label var cong "number of congressional contacts"

. bys registrantid clientcountry fyear fmonth: egen cong_leader = sum(leader)

. label var cong_leader "number of contacts to congressional leaders"

. bys registrantid clientcountry fyear fmonth: egen cong_foreign = sum(foreign)

. label var cong_foreign "number of contacts to foreign affairs/relations"

. gen cfdiff = abs(cfscore-polcfscore)
(8,395 missing values generated)

. sum cfdiff, detail

                           cfdiff
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0053233       .0001485
 5%     .0367549       .0001485
10%     .0611865         .00123       Obs               5,916
25%     .1411609       .0017982       Sum of Wgt.       5,916

50%     .3728391                      Mean           .5062634
                        Largest       Std. Dev.        .44356
75%     .7661609       2.141722
90%     1.214839       2.143948       Variance       .1967455
95%     1.340901       2.218841       Skewness       1.033155
99%     1.752833       2.335709       Kurtosis       3.324131

. replace a = 0
(14,311 real changes made)

. replace a = 1 if cfdiff<r(p50)
(2,952 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close = sum(a)

. label var cong_close "number of contacts by a close lobbyist"

. gen lob_dwmean = .
(14,311 missing values generated)

. replace lob_dwmean = expol_dw if expol_dw != .
(972 real changes made)

. replace lob_dwmean = mem1_dw if mem1_dw! = . & mem2_dw == .
(1,235 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw)/2 if mem1_dw! = . & mem2_dw != . & mem3_dw == . 
(208 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw+mem3_dw)/3 if mem1_dw! = . & mem2_dw != . & mem3_dw != . 
(139 real changes made)

. gen dwdiff = abs(dwnom1-lob_dwmean)
(11,776 missing values generated)

. sum dwdiff, detail

                           dwdiff
-------------------------------------------------------------
      Percentiles      Smallest
 1%         .002              0
 5%        .0135              0
10%         .027              0       Obs               2,535
25%     .0666667              0       Sum of Wgt.       2,535

50%         .152                      Mean           .2578412
                        Largest       Std. Dev.      .2753223
75%         .328       1.235333
90%        .7315          1.252       Variance       .0758024
95%          .87          1.307       Skewness       1.548115
99%     1.114333          1.319       Kurtosis       4.557162

. replace a = 0
(2,952 real changes made)

. replace a = 1 if dwdiff<r(p50)
(1,267 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close_dw = sum(a)

. label var cong_close_dw "number of contacts by a close lobbyist (DW)"

. gen partydiff = .
(14,311 missing values generated)

. replace partydiff = 1 if democrat == 1 & lob_rep == 1
(944 real changes made)

. replace partydiff = 1 if democrat == 0 & lob_rep == 0
(166 real changes made)

. replace partydiff = 0 if democrat == 0 & lob_rep == 1
(2,340 real changes made)

. replace partydiff = 0 if democrat == 1 & lob_rep == 0
(1,596 real changes made)

. replace a = 0
(1,267 real changes made)

. replace a = 1 if partydiff == 0
(3,936 real changes made)

. bys registrantid clientcountry fyear fmonth: egen cong_close_py = sum(a)

. label var cong_close_dw "number of contacts by a same-party lobbyist"

. gen ck = 0

. replace ck = 1 if cfdiff ==.
(8,395 real changes made)

. bys registrantid clientcountry fyear fmonth: egen nocfinfo = min(ck)

. keep registrantid clientcountry fyear fmonth cong cong_leader cong_foreign cong_close* nocfinfo

. duplicates drop

Duplicates in terms of all variables

(13,644 observations deleted)

. merge 1:1 registrantid clientcountry fyear fmonth using temp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           172
        from master                        27  (_merge==1)
        from using                        145  (_merge==2)

    matched                               640  (_merge==3)
    -----------------------------------------

. replace cong = 0 if _merge == 2
(145 real changes made)

. replace cong_leader = 0 if _merge == 2
(145 real changes made)

. replace cong_foreign = 0 if _merge == 2
(145 real changes made)

. replace cong_close = 0 if _merge == 2
(145 real changes made)

. replace nocfinfo = 0 if _merge == 2
(145 real changes made)

. replace media = 0 if _merge == 1
(27 real changes made)

. replace exec = 0 if _merge == 1
(27 real changes made)

. replace cong_comm = 0 if _merge == 1
(27 real changes made)

. replace iss_bud = 0 if _merge == 1
(27 real changes made)

. replace iss_sec = 0 if _merge == 1
(27 real changes made)

. replace iss_trd = 0 if _merge == 1
(27 real changes made)

. drop _merge

. save temp.dta, replace
file temp.dta saved

. clear

. use clientcountry_yearly.dta

. bys clientcountry: egen UNagree = mean(pctagreeus)
(88 missing values generated)

. keep clientcountry UNagree polity

. duplicates drop

Duplicates in terms of all variables

(627 observations deleted)

. sum UNagree, detail

                           UNagree
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0519484       .0510393
 5%     .0728319       .0519484
10%      .078001       .0550153       Obs                 187
25%     .0902993       .0609871       Sum of Wgt.         187

50%     .1097886                      Mean           .1795149
                        Largest       Std. Dev.      .1364751
75%     .3144231       .6169736
90%     .3473414       .6850649       Variance       .0186255
95%     .3658378        .710223       Skewness       1.720873
99%      .710223       .7737534       Kurtosis       6.151824

. sum polity,detail

                   polity IV score in 2005
-------------------------------------------------------------
      Percentiles      Smallest
 1%          -10            -10
 5%           -8            -10
10%           -7            -10       Obs                 162
25%           -3             -9       Sum of Wgt.         162

50%            6                      Mean           3.512346
                        Largest       Std. Dev.      6.540118
75%            9             10
90%           10             10       Variance       42.77314
95%           10             10       Skewness      -.6902038
99%           10             10       Kurtosis       1.951237

. save clienttemp.dta, replace
(note: file clienttemp.dta not found)
file clienttemp.dta saved

. clear

. use contracts_list.dta

. merge 1:1 registrantid clientcountry fyear fmonth using temp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           164
        from master                         0  (_merge==1)
        from using                        164  (_merge==2)

    matched                               648  (_merge==3)
    -----------------------------------------

. drop if _merge == 2     
(164 observations deleted)

. drop _merge

. erase temp.dta

. merge n:1 registrantid fyear fmonth using registrant_info.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            19
        from master                         0  (_merge==1)
        from using                         19  (_merge==2)

    matched                               648  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(19 observations deleted)

. drop _merge

. merge n:1 clientcountry using clienttemp.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                           124
        from master                         2  (_merge==1)
        from using                        122  (_merge==2)

    matched                               646  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(122 observations deleted)

. drop _merge

. erase clienttemp.dta

. gen lfee = log(fee)
(24 missing values generated)

. gen numlob2 = numlob*numlob
(24 missing values generated)

. gen nhclients2 = nhclients*nhclients

. replace cong = cong + cong_comm
(386 real changes made)

. gen insample = 1

. replace insample = 0 if nocfinfo == 1
(424 real changes made)

. gen autocracy = 0

. replace autocracy = 1 if polity<=0
(187 real changes made)

. gen close_auto = cong_close*autocracy

. gen close_auto_dw = cong_close_dw*autocracy

. gen close_auto_py = cong_close_py*autocracy

. gen cong_auto = cong*autocracy

. rename cong any

. rename cong_close ideologically_aligned

. rename cong_auto onbehalfof_autocraacy

. rename close_auto ideologically_aligned_autocracy

. rename media anymedia

. rename exec anyexecutive

. rename domestic registeredLDA

. rename startyear yearofFARAregistration

. rename numlob numberoflobbyist

. rename numlob2 numberoflobbyist_squared 

. macro define contact_chr "any ideologically_aligned anymedia anyexecutive"

. macro define contact_chr2 "onbehalfof_autocraacy ideologically_aligned_autocracy autocracy"

. macro define fara_chr "registeredLDA yearofFARAregistration numberoflobbyist numberoflobbyist_squared"

. 
. * regression results
. eststo clear

. eststo: quietly reg lfee $contact_chr if insample == 1, cluster(registrantid) 
(est1 stored)

. eststo: quietly reg lfee $contact_chr $fara_chr if insample == 1 , cluster(registrantid)
(est2 stored)

. eststo: quietly reg lfee $contact_chr $contact_chr2 if insample == 1, cluster(registrantid)
(est3 stored)

. eststo: quietly reg lfee $contact_chr $contact_chr2 $fara_chr if insample == 1 , cluster(registrantid)
(est4 stored)

. esttab, star(* 0.10 ** 0.05 *** 0.01) se ar2 b(%5.4f)

----------------------------------------------------------------------------
                      (1)             (2)             (3)             (4)   
                     lfee            lfee            lfee            lfee   
----------------------------------------------------------------------------
any                0.0035***       0.0042**        0.0036***       0.0045** 
                 (0.0009)        (0.0016)        (0.0009)        (0.0021)   

ideologica~d       0.0054**        0.0037          0.0045*         0.0016   
                 (0.0022)        (0.0039)        (0.0024)        (0.0046)   

anymedia           0.0243**        0.0101          0.0233**        0.0111   
                 (0.0101)        (0.0091)        (0.0099)        (0.0104)   

anyexecutive       0.0058          0.0115          0.0055          0.0112   
                 (0.0083)        (0.0105)        (0.0078)        (0.0104)   

registered~A                      -0.2957                         -0.2692   
                                 (0.3301)                        (0.4027)   

yearofFARA~n                      -0.0209                         -0.0223   
                                 (0.0142)                        (0.0138)   

numberoflo~t                       0.0870***                       0.0852***
                                 (0.0274)                        (0.0275)   

numberoflo~d                      -0.0025***                      -0.0025***
                                 (0.0008)                        (0.0008)   

onbehalfof~y                                       0.0020          0.0014   
                                                 (0.0031)        (0.0037)   

ideologica~y                                       0.0219***       0.0253***
                                                 (0.0077)        (0.0087)   

autocracy                                          0.1008         -0.0599   
                                                 (0.2410)        (0.2745)   

_cons             11.5832***      53.3172*        11.5213***      56.0169** 
                 (0.1046)       (28.3860)        (0.1266)       (27.5481)   
----------------------------------------------------------------------------
N                     214             203             214             203   
adj. R-sq           0.113           0.179           0.140           0.197   
----------------------------------------------------------------------------
Standard errors in parentheses
* p<0.10, ** p<0.05, *** p<0.01

. 
. 
. 
. *******************************************************************************
. * Appendix Table A1: Lobbying Firms Characteristics by the LDA Registration   
. *******************************************************************************
. clear

. use lobbyist_attributes.dta

. keep registrantid lob_lastname lob_firstname expol staffer whitehouse

. sort registrantid lob_lastname lob_firstname

. bys registrantid: egen numexpol = sum(expol)

. bys registrantid: egen numexstaff = sum(staffer)

. bys registrantid: egen numexwhite = sum(whitehouse)

. keep registrantid numexpol numexstaff numexwhite

. duplicates drop

Duplicates in terms of all variables

(166 observations deleted)

. sort registrantid 

. save temp.dta, replace 
(note: file temp.dta not found)
file temp.dta saved

. clear

. use contacts.dta

. keep if congress>=110 & congress<=111
(1,182 observations deleted)

. drop lob_lastname1-lob_firstname4

. merge n:1 registrantid fyear fmonth using registrant_info.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            19
        from master                         0  (_merge==1)
        from using                         19  (_merge==2)

    matched                            13,146  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(19 observations deleted)

. drop _merge

. sort  registrantid 

. merge registrantid using temp.dta
(note: you are using old merge syntax; see [D] merge for new syntax)
variable registrantid does not uniquely identify observations in the master data

. drop if _merge == 2
(2 observations deleted)

. drop _merge

. bys registrantid memberid: gen tt = _n ==1

. bys registrantid: egen nummem = sum(tt)

. keep registrantid registrantname startyear domestic numlob_all numexpol numexstaff numexwhite nummem 

. duplicates drop

Duplicates in terms of all variables

(13,038 observations deleted)

. sort registrantid 

. save temp_firmchar.dta, replace
(note: file temp_firmchar.dta not found)
file temp_firmchar.dta saved

. clear

. use contracts_list.dta

. bys registrantid fyear: egen totfee = sum(fee)

. bys registrantid: egen yearfee = mean(totfee)

. bys registrantid clientcountry: gen tt = _n ==1

. bys registrantid: egen nclient = sum(tt)

. keep registrantid yearfee nclient

. duplicates drop

Duplicates in terms of all variables

(540 observations deleted)

. sort registrantid

. save temp.dta, replace
file temp.dta saved

. clear

. use temp_firmchar.dta

. sort registrantid

. merge registrantid using temp.dta
(note: you are using old merge syntax; see [D] merge for new syntax)

. drop _merge

. replace yearfee = yearfee/1000
(106 real changes made)

. label var numexpol "number of former member of congress"

. label var numexstaff "number of former congress staff"

. label var numexwhite "number of executive branch experience"

. label var nummem "number of contacted members"

. label var yearfee "annual revenue ($K)"

. label var nclient "number of government client"

. rename yearfee ann_rev

. rename nclient num_client

. rename nummem num_contact_mem

. rename startyear FARA_regis

. rename numlob_all all_lobbyists

. rename numexpol former_mem_cong

. rename numexstaff former_cong_staff

. rename numexwhite exec_branch_exp

. 
. * descriptive statistics: 
. * LDA & FARA 
. tabstat ann_rev num_client num_contact_mem FARA_regis all_lobbyists former_mem_cong former_cong_staff exec_bran
> ch_exp if domestic ==1, stat(N mean sd) col(stat)

    variable |         N      mean        sd
-------------+------------------------------
     ann_rev |        72  539.1222  652.9297
  num_client |        72  2.291667  2.010098
num_contac~m |        72  45.59722  59.76472
  FARA_regis |        72  2002.028  9.230953
all_lobbyi~s |        72    15.375  18.97993
former_mem~g |        48  .5833333  1.107678
former_con~f |        48  2.020833   2.62143
exec_branc~p |        48    1.0625  1.227456
--------------------------------------------

. * FARA Only
. tabstat ann_rev num_client num_contact_mem FARA_regis all_lobbyists former_mem_cong former_cong_staff exec_bran
> ch_exp if domestic ==0, stat(N mean sd) col(stat)

    variable |         N      mean        sd
-------------+------------------------------
     ann_rev |        36  420.0638  675.7253
  num_client |        36  1.277778  .7014724
num_contac~m |        36  31.02778  44.67693
  FARA_regis |        36  2005.972  3.459861
all_lobbyi~s |        36  4.166667  4.526115
former_mem~g |        27  .1111111  .3202563
former_con~f |        27  .2592593  .5943706
exec_branc~p |        27  .1851852  .4833407
--------------------------------------------

. 
. 
. *****************************************************************************
. * Appendix Table A2: Report-Level Summary Statistics                        *
. *****************************************************************************
. clear

. use contracts_list.dta 

. sort registrantid fyear fmonth 

. merge registrantid fyear fmonth using registrant_info.dta
(note: you are using old merge syntax; see [D] merge for new syntax)
variables registrantid fyear fmonth do not uniquely identify observations in the master data

. keep if _merge == 3
(19 observations deleted)

. drop _merge

. gen a = 1

. bys registrantid fyear fmonth: egen nfclients = sum(a)

. bys registrantid fyear fmonth: egen totfee = sum(fee)

. keep registrantid fyear fmonth nfclients totfee numlob 

. label var nfclients "number of clients during the filing period"

. label var totfee "total fees during the filing period"

. duplicates drop

Duplicates in terms of all variables

(208 observations deleted)

. merge 1:n registrantid fyear fmonth using contacts.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,035
        from master                         0  (_merge==1)
        from using                      1,035  (_merge==2)

    matched                            13,293  (_merge==3)
    -----------------------------------------

. keep if _merge == 3
(1,035 observations deleted)

. drop _merge

. keep if congress == 110 | congress == 111
(147 observations deleted)

. save temp_lobsource.dta, replace
(note: file temp_lobsource.dta not found)
file temp_lobsource.dta saved

. clear

. use registrant_info.dta

. keep registrantid startyear domestic

. duplicates drop

Duplicates in terms of all variables

(349 observations deleted)

. sort registrantid

. save temp.dta, replace
file temp.dta saved

. clear

. use temp_lobsource.dta

. sort registrantid 

. merge registrantid using temp.dta
(note: you are using old merge syntax; see [D] merge for new syntax)
variable registrantid does not uniquely identify observations in the master data

. drop if _merge ==2
(2 observations deleted)

. save temp_lobsource.dta, replace
file temp_lobsource.dta saved

. erase temp.dta

. clear

. use temp_lobsource.dta

. gen rpt = 0

. replace rpt = 1 if lobsource == "report"
(5,172 real changes made)

. gen one = 0

. replace one = 1 if lobsource == "one man shop" // numlob > 1 for some cases
(1,874 real changes made)

. bys registrantid fyear fmonth: egen source_rpt = max(rpt)

. bys registrantid fyear fmonth: egen source_one = max(one)

. bys registrantid fyear fmonth: gen r = _n == 1

. gen source_type = "3. not retri"

. replace source_type = "2. report" if source_rpt == 1
(6,198 real changes made)

. replace source_type = "1. one-man" if source_rpt == 0 & source_one == 1
(1,063 real changes made)

. * contact attributes
. bys registrantid fyear fmonth memberid: gen a = _n ==1

. bys registrantid fyear fmonth: egen nummem = sum(a)

. drop a

. gen nummem_perlob = nummem/numlob
(253 missing values generated)

. gen a = 1

. bys registrantid fyear fmonth: egen numcont = sum(a)

. drop a

. gen numcont_perlob = numcont/numlob
(253 missing values generated)

. gen a = 0

. replace a = 1 if contactlevel == "Member"
(3,442 real changes made)

. bys registrantid fyear fmonth: egen numdir = sum(a)

. drop a

. gen numdir_perlob = numdir/numlob
(253 missing values generated)

. rename totfee fee

. replace fee = fee/1000
(13,049 real changes made)

. keep registrantid fyear fmonth source_type fee nfclients nummem numcont numdir startyear domestic numlob 

. duplicates drop 

Duplicates in terms of all variables

(12,706 observations deleted)

. label var source_type "report source type"

. label var nummem "number of contacted member"

. label var numcont "number of total contacts"

. label var numdir "number of direct contacts"

. 
. * Column 2: "Inferred, a Single Lobbyist"
. tabstat nfclients fee startyear domestic numlob numcont if source_type =="1. one-man", stat(N mean) col(stat)

    variable |         N      mean
-------------+--------------------
   nfclients |        87   1.08046
         fee |        87  158.6267
   startyear |        87  2003.805
    domestic |        87  .4137931
      numlob |        86  2.918605
     numcont |        87  12.21839
----------------------------------

. * Column 3: "Observed from the Report"
. tabstat nfclients fee startyear domestic numlob numcont if source_type =="2. report", stat(N mean) col(stat)

    variable |         N      mean
-------------+--------------------
   nfclients |       139  1.597122
         fee |       139  405.8295
   startyear |       139  2003.058
    domestic |       139  .8201439
      numlob |       126  11.19841
     numcont |       139  44.58993
----------------------------------

. * Column 4: "Not Retrieved"
. tabstat nfclients fee startyear domestic numlob numcont if source_type =="3. not retri", stat(N mean) col(stat)

    variable |         N      mean
-------------+--------------------
   nfclients |       214  1.551402
         fee |       214  383.5506
   startyear |       214   1999.22
    domestic |       214  .7476636
      numlob |       204  15.07843
     numcont |       214      27.5
----------------------------------

. 
. 
. ******************************************************************************
. * Appendix Table A3: Specialization                                            
. ******************************************************************************
. clear

. use contacts.dta

. merge n:1 registrantid lob_lastname lob_firstname using lobbyist_attributes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         6,603
        from master                     6,586  (_merge==1)
        from using                         17  (_merge==2)

    matched                             7,742  (_merge==3)
    -----------------------------------------

. keep if _merge == 3
(6,603 observations deleted)

. drop _merge

. merge n:n icpsr congress using masterdata_congress.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                         1,564
        from master                         0  (_merge==1)
        from using                      1,564  (_merge==2)

    matched                             7,743  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(1,564 observations deleted)

. drop _merge

. duplicates drop

Duplicates in terms of all variables

(18 observations deleted)

. replace primary_committee = upper(primary_committee)
(7,725 real changes made)

. gen leader = 0

. replace leader = 1 if maj_leader == 1
(510 real changes made)

. replace leader = 1 if min_leader == 1
(441 real changes made)

. replace leader = 1 if primary_committee == "SPEAKER"
(74 real changes made)

. replace leader = 1 if primary_committee == "MAJORITY LEADER"
(1 real change made)

. replace leader = 1 if primary_committee == "MAJORITY WHIP"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY LEADER"
(0 real changes made)

. replace leader = 1 if primary_committee == "MINORITY WHIP"
(0 real changes made)

. replace leader = 1 if chair == 1
(1,042 real changes made)

. label var leader "party leaders"

. gen foreign = 0

. replace foreign = 1 if primary_committee == "FOREIGN AFFAIRS"
(534 real changes made)

. replace foreign = 1 if primary_committee == "FOREIGN RELATIONS"
(206 real changes made)

. label var foreign "foreign relations/affairs committee"

. gen cfdiff = abs(cfscore-polcfscore)
(1,809 missing values generated)

. gen lob_dwmean = .
(7,725 missing values generated)

. replace lob_dwmean = expol_dw if expol_dw != .
(972 real changes made)

. replace lob_dwmean = mem1_dw if mem1_dw! = . & mem2_dw == .
(1,235 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw)/2 if mem1_dw! = . & mem2_dw != . & mem3_dw == . 
(208 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw+mem3_dw)/3 if mem1_dw! = . & mem2_dw != . & mem3_dw != . 
(139 real changes made)

. gen dwdiff = abs(dwnom1-lob_dwmean)
(5,190 missing values generated)

. label var dwdiff "DWNOMINATE score difference btw politician and lobbyist"

. gen partydiff = .
(7,725 missing values generated)

. replace partydiff = 1 if democrat == 1 & lob_rep == 1
(944 real changes made)

. replace partydiff = 1 if democrat == 0 & lob_rep == 0
(166 real changes made)

. replace partydiff = 0 if democrat == 0 & lob_rep == 1
(2,340 real changes made)

. replace partydiff = 0 if democrat == 1 & lob_rep == 0
(1,596 real changes made)

. label var partydiff "Party difference btw politician and lobbyist"

. replace issue = "OTH" if issue == "GEN"
(18 real changes made)

. replace issue = "OTH" if issue == "ADM"
(661 real changes made)

. sum cfdiff, detail

                           cfdiff
-------------------------------------------------------------
      Percentiles      Smallest
 1%     .0053233       .0001485
 5%     .0367549       .0001485
10%     .0611865         .00123       Obs               5,916
25%     .1411609       .0017982       Sum of Wgt.       5,916

50%     .3728391                      Mean           .5062634
                        Largest       Std. Dev.        .44356
75%     .7661609       2.141722
90%     1.214839       2.143948       Variance       .1967455
95%     1.340901       2.218841       Skewness       1.033155
99%     1.752833       2.335709       Kurtosis       3.324131

. gen close = .
(7,725 missing values generated)

. replace close = 0 if cfdiff>=r(p50) & cfdiff!=.
(2,964 real changes made)

. replace close = 1 if cfdiff<r(p50)
(2,952 real changes made)

. gen a = 0

. replace a = 1 if issue == "SEC"
(1,817 real changes made)

. bys registrantid lob_lastname lob_firstname icpsr: egen sec_lob = max(a)

. replace a = 0
(1,817 real changes made)

. replace a = 1 if issue == "TRD" | issue == "BUD"
(3,635 real changes made)

. bys registrantid lob_lastname lob_firstname icpsr: egen trd_lob = max(a)

. bys registrantid lob_lastname lob_firstname icpsr issue: gen ii = _n == 1

. bys registrantid lob_lastname lob_firstname icpsr: egen numissue = sum(ii)

. gen multilob = .
(7,725 missing values generated)

. replace multilob = 1 if sec_lob == 1 & trd_lob == 1
(251 real changes made)

. replace multilob = 0 if sec_lob == 1 & trd_lob == 0
(2,224 real changes made)

. replace multilob = 0 if sec_lob == 0 & trd_lob == 1
(4,019 real changes made)

. keep registrantid lob_lastname lob_firstname icpsr cfdiff close sec_lob trd_lob multilob numissue  

. duplicates drop

Duplicates in terms of all variables

(4,716 observations deleted)

. egen lobid = group(registrantid lob_lastname lob_firstname)

. 
. * regression results
. eststo clear

. eststo: quietly areg multilob cfdiff, absorb(lobid) cluster(lobid)
(est1 stored)

. eststo: quietly areg multilob cfdiff i.lobid, absorb(icpsr) cluster(lobid)
(est2 stored)

. eststo: quietly areg multilob close, absorb(lobid) cluster(lobid)
(est3 stored)

. eststo: quietly areg multilob close i.lobid, absorb(icpsr) cluster(lobid)
(est4 stored)

. esttab, star(* 0.10 ** 0.05 *** 0.01) se r2 keep(cfdiff close) b(%5.4f)

----------------------------------------------------------------------------
                      (1)             (2)             (3)             (4)   
                 multilob        multilob        multilob        multilob   
----------------------------------------------------------------------------
cfdiff            -0.0068         -0.0066                                   
                 (0.0043)        (0.0092)                                   

close                                              0.0074          0.0063   
                                                 (0.0076)        (0.0087)   
----------------------------------------------------------------------------
N                    1704            1704            1704            1704   
R-sq                0.125           0.361           0.125           0.361   
----------------------------------------------------------------------------
Standard errors in parentheses
* p<0.10, ** p<0.05, *** p<0.01

. 
. 
. ******************************************************************************
. * Appendix Figure A1: Distribution of Ideology Measures by Party Affiliation *
. ******************************************************************************
. clear

. use main_panel_summary.dta

. bys registrantid lob_lastname lob_firstname: gen ll = _n == 1

. keep if ll == 1
(124,051 observations deleted)

. merge 1:1 registrantid lob_lastname lob_firstname using lobbyist_attributes.dta

    Result                           # of obs.
    -----------------------------------------
    not matched                            20
        from master                         0  (_merge==1)
        from using                         20  (_merge==2)

    matched                               223  (_merge==3)
    -----------------------------------------

. keep if _merge == 3
(20 observations deleted)

. drop _merge

. gen lob_dwmean = .
(223 missing values generated)

. replace lob_dwmean = expol_dw if expol_dw != .
(21 real changes made)

. replace lob_dwmean = mem1_dw if mem1_dw! = . & mem2_dw == .
(85 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw)/2 if mem1_dw! = . & mem2_dw != . & mem3_dw == . 
(7 real changes made)

. replace lob_dwmean = (mem1_dw+mem2_dw+mem3_dw)/3 if mem1_dw! = . & mem2_dw != . & mem3_dw != . 
(5 real changes made)

. * Panel (a)
. twoway (hist cfscore if lob_democrat == 1, freq start(-1.25) width(0.05) lcolor(gs12) fcolor(gs12) xtitle("Lobb
> yist's CF Score")  ///
>        graphregion(color(white))) (hist cfscore if lob_republican == 1, freq start(-1.25) width(0.05) fcolor(no
> ne) lcolor(black)) ///
>        ,legend(order(1 "Democrat Lobbyist" 2 "Republican Lobbyist") cols(3)) xlabel(-1(0.5)1) xscale(range(-1.2
> 5 1.25)) 

.            
. * Panel (b)
. twoway (hist lob_dwmean if lob_democrat == 1, freq start(-.60) width(0.05) lcolor(gs12) fcolor(gs12) xtitle("Lo
> bbyist's DW-NOMINATE Score")  ///
>        graphregion(color(white))) (hist lob_dwmean if lob_republican == 1, freq start(-.60) width(0.05) fcolor(
> none) lcolor(black)) ///
>        ,legend(order(1 "Democrat Lobbyist" 2 "Republican Lobbyist") cols(3)) xlabel(-1(0.5)1) xscale(range(-1 1
> )) 

. 
. erase temp_firmchar.dta    

. erase temp_lobsource.dta

.            
. log close
      name:  <unnamed>
       log:  /Users/hy21/Dropbox/Lobbyists as Gatekeeper_Combined/Data Files and Code/JOP replication/replication
> .log
  log type:  text
 closed on:   8 Aug 2022, 18:28:07
-----------------------------------------------------------------------------------------------------------------
